<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('labourers', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('project_id')->index();
            $table->string('name');
            $table->string('avatar')->nullable();//身份证照片
            $table->string('mobile')->unique();//电话
            $table->tinyInteger('sex')->default(1);
            $table->string('idcard')->default('/');
            $table->string('idcard_file')->nullable();
            $table->string('password')->nullable();
            $table->string('post')->nullable()->default('/')->comment('岗位');
            $table->string('work')->nullable()->default('/')->comment('工种');
            $table->string('bank')->nullable()->default('/')->comment('开户银行');
            $table->string('bank_number')->nullable()->default('/')->comment('银行帐号');
            $table->string('type')->nullable()->default('/')->comment('承包类型');
            $table->string('province')->nullable()->default('/')->comment('省');
            $table->string('city')->nullable()->default('/')->comment('城市');
            $table->string('openid')->nullable();
            $table->string('ip')->nullable();
            $table->tinyInteger('status')->default(1);
            $table->unsignedBigInteger('basic_salary')->default(0)->comment('单价');
            $table->string('work_time')->nullable()->comment('工作时间');
            $table->string('region')->nullable()->comment('施工区域');
            $table->date('start_date')->nullable();
            $table->date('end_date')->nullable();
            $table->string('remarks')->default('/');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('labourers');
    }
};
